home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / music / gmod211.zip / REN-93.ASM < prev    next >
Assembly Source File  |  1993-03-13  |  26KB  |  887 lines

  1. stak    segment stack 'stack'
  2. stak    ends
  3. code    segment
  4. code    ends
  5. buf     segment para
  6. buf     ends
  7.  
  8. stak    segment stack 'stack'
  9.         assume cs:code, ss:stak
  10.         dw 40h dup(?)
  11. stak    ends
  12.  
  13. code    segment
  14.         assume cs:code, ds:code, ss:stak
  15.         org     0
  16.  
  17. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  18. ; DATA
  19. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  20. NRF=72
  21. CCYCWAIT=16
  22.  
  23. errmsg0 db      'VGA card not found!!!$'
  24. errmsg1 db      'Not enough memory!!!$'
  25.  
  26. oirqm           db      ?,?
  27. oirq1           dw      ?,?
  28.  
  29. doneflag        db      0
  30.  
  31. charmap db      0,0,0,0, 192,240,248,248, 252,252,252,252, 124,124,60,60
  32.         db      60,60,124,124, 252,252,252,252,248,248,240,192, 0,0,0,0
  33.         db      24,60,60,60, 60,60,60,60, 60,60,60,24, 0,0,0,0
  34.         db      0,0,0,0, 60,126,255,255, 255,255,126,60, 0,0,0,0
  35.         db      96,240,240,248, 248,120,124,60, 60,62,30,31, 31,15,15,6
  36.         db      16 dup(60)
  37.         db      11 dup(60), 24, 0,0,0,0
  38.         db      0,0,0,0, 24, 11 dup(60)
  39.         db      0,0,0,0, 252,254,255,255, 255,255,254,252, 0,0,0,0
  40.         db      60,60,124,124, 252,252,252,252, 252,252,252,252, 124,124,60,60
  41.         db      0,0,0,0, 3,15,31,31, 63,63,63,63, 62,62,60,60
  42.         db      60,60,62,62, 63,63,63,63, 31,31,15,3, 0,0,0,0
  43.         db      0,0,0,0, 63,127,255,255, 255,255,127,63, 0,0,0,0
  44.         db      60,60,62,62, 63,63,63,63, 63,63,63,63, 62,62,60,60
  45.  
  46. renlogo db      192,182,32,192,190,32,189,32, 189,32,192,182,32,189,32,192,190,32,192,190,32,192,182,32,189,32, 189,32,192,190,32,192,190
  47.         db      195,183,32,187,185,32,187,186,187,32,195,191,32,187,32,193,182,32,193,182,32,195,191,32,187,186,187,32,187,32, 32,187,185
  48.         db      188,184,32,193,190,32,188,32, 188,32,188,188,32,188,32,194,183,32,194,183,32,188,188,32,188,32, 188,32,193,190,32,193,190
  49.  
  50. bardata dw      1,calcbufcar1,_ret,_ret,_ret,calcbufcsr1,_ret,_ret,_ret
  51.         dw      6,calcbufcar1,_ret,_ret,_ret,calcbufcsr1,_ret,_ret,_ret
  52.         dw      11,calcbufcar1,_ret,calcbufcar1,_ret,calcbufcsr1,_ret,calcbufcsr1,_ret
  53.         dw      16,calcbufcar1,_ret,calcbufcar1,_ret,calcbufcsr1,_ret,calcbufcsr1,_ret
  54.         dw      21,calcbufcar1,calcbufcar1,calcbufcar1,_ret,calcbufcsr1,calcbufcsr1,calcbufcsr1,_ret
  55.         dw      26,calcbufcar1,calcbufcar1,calcbufcar1,_ret,calcbufcsr1,calcbufcsr1,calcbufcsr1,_ret
  56.         dw      31,calcbufcar1,calcbufcar1,calcbufcar1,calcbufcar1,calcbufcsr1,calcbufcsr1,calcbufcsr1,calcbufcsr1
  57.         dw      36,calcbufcar2,calcbufcar1,calcbufcar1,calcbufcar1,calcbufcsr2,calcbufcsr1,calcbufcsr1,calcbufcsr1
  58.         dw      41,calcbufcar2,calcbufcar1,calcbufcar2,calcbufcar1,calcbufcsr2,calcbufcsr1,calcbufcsr2,calcbufcsr1
  59.         dw      46,calcbufcar2,calcbufcar2,calcbufcar2,calcbufcar1,calcbufcsr2,calcbufcsr2,calcbufcsr2,calcbufcsr1
  60.         dw      51,calcbufcar2,calcbufcar2,calcbufcar2,calcbufcar2,calcbufcsr2,calcbufcsr2,calcbufcsr2,calcbufcsr2
  61.         dw      0
  62.  
  63. rlltbl  dw      80,-80,2560,2560+80,2560-80,-2560,-2560+80,-2560-80
  64.         dw      -1280-120,-1280-40,-1280+40,-1280+120,1280-120,1280-40,1280+40,1280+120
  65.         dw      -3840-120,-3840-40,-3840+40,-3840+120,3840-120,3840-40,3840+40,3840+120
  66.         dw      5120,5120+80,5120-80
  67.  
  68. pbarf   dw      pbarr0,pbarr1,pbarr2,pbarr3,pbarr4,pbarr5,pbarr6,pbarr7,pbarr7
  69.  
  70. xofftbl db      8,0,1,2,3,4,5,6,7
  71.  
  72. text    db      2,22,17h,'Greetings everyone from',0
  73.         db      2,46,1fh,'Renaissance',0
  74.         db      -2,30h
  75.         db      2,22,17h,'                       ',0
  76.         db      2,46,1fh,'           ',0
  77.         db      1,23,17h,'Starring ... the',0
  78.         db      1,40,1fh,'Renaissance',0
  79.         db      1,52,17h,'crew:',0
  80.         db      -2,10h
  81.         db      3,10,1fh,'Tran',0
  82.         db      3,20,17h,'- Main Coder',0
  83.         db      4,10,1fh,'C.C.Catch',0
  84.         db      4,20,17h,'- Muzician',0
  85.         db      5,10,1fh,'Daredevil',0
  86.         db      5,20,17h,'- Coder/Sysop/PR',0
  87.         db      3,47,1fh,'White Shadow',0
  88.         db      3,60,17h,'- Coder',0
  89.         db      4,47,1fh,'Zeek',0
  90.         db      4,60,17h,'- Coder',0
  91.         db      5,47,1fh,'CyberStrike',0
  92.         db      5,60,17h,'- Coder',0
  93.         db      -2,40h
  94.         db      1,23,17h,'                ',0
  95.         db      1,40,1fh,'           ',0
  96.         db      1,52,17h,'     ',0
  97.         db      3,10,1fh,'    ',0
  98.         db      3,20,17h,'            ',0
  99.         db      4,10,1fh,'         ',0
  100.         db      4,20,17h,'          ',0
  101.         db      5,10,1fh,'         ',0
  102.         db      5,20,17h,'                ',0
  103.         db      3,47,1fh,'            ',0
  104.         db      3,60,17h,'       ',0
  105.         db      4,47,1fh,'    ',0
  106.         db      4,60,17h,'       ',0
  107.         db      5,47,1fh,'           ',0
  108.         db      5,60,17h,'       ',0
  109.         db      1,11,17h,'If you really must, you can contact us on',0
  110.         db      1,53,1fh,'The Sound Barrier',0
  111.         db      -2,10h
  112.         db      3,25,1fh,'FidoNet',0
  113.         db      3,44,17h,'- 1:2603/304',0
  114.         db      4,25,1fh,'SBCNet',0
  115.         db      4,44,17h,'- 13:420/0',0
  116.         db      5,25,1fh,'Creativity DemoNet',0
  117.         db      5,44,17h,'- 94:87/0',0
  118.         db      6,25,1fh,'TSANNet',0
  119.         db      6,44,17h,'- 66:718/6',0
  120.         db      -2,30h
  121.         db      3,25,1fh,'       ',0
  122.         db      3,44,17h,'            ',0
  123.         db      4,25,1fh,'      ',0
  124.         db      4,44,17h,'          ',0
  125.         db      5,25,1fh,'                  ',0
  126.         db      5,44,17h,'         ',0
  127.         db      6,25,1fh,'       ',0
  128.         db      6,44,17h,'          ',0
  129.         db      3,25,17h,'And ofcourse, the fone numbers:',0
  130.         db      4,33,1fh,'(718)979-6629',0
  131.         db      5,33,1fh,'(718)979-9406',0
  132.         db      -2,20h
  133.         db      1,11,17h,'                                         ',0
  134.         db      1,53,1fh,'                 ',0
  135.         db      3,25,17h,'                               ',0
  136.         db      4,33,1fh,'             ',0
  137.         db      5,33,1fh,'             ',0
  138.         db      3,14,17h,'If you missed anything, this text will now repeat...',0
  139.         db      -2,10h
  140.         db      3,14,17h,'                                                    ',0
  141.         db      -1
  142.  
  143. EVEN
  144. ccycvals        dw      606h
  145. ccycdeltas      dw      0ffffh
  146. c0cycrout       dw      c0cycr0
  147. c1cycrout       dw      c1cycr0
  148. c0cycdelay      dw      720
  149. c1cycdelay      dw      360
  150. c0cycwait       db      CCYCWAIT
  151. c1cycwait       db      CCYCWAIT
  152.  
  153. textrout        dw      txtdelay
  154. textwait        dw      200
  155. textptr         dw      text
  156. textcharloc     dw      ?
  157. textchar        db      ?
  158. textattr        db      ?
  159. textloc         dw      ?
  160. textbltloc      dw      ?
  161.  
  162. textbltmap      db      82h,9,44h,50h,24h,9,90h,42h, 82h,9,44h,50h,24h,9,90h
  163.  
  164. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  165. ; CODE
  166. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  167.  
  168. ;═════════════════════════════════════════════════════════════════════════════
  169. nirq1:                                  ; Program KB handler
  170.         push ax
  171.         in al,60h
  172.         cmp al,1
  173.         jne short nirq1f0
  174.         mov cs:doneflag,al
  175. nirq1f0:
  176.         mov al,20h
  177.         out 20h,al
  178.         pop ax
  179. ;       jmp dword ptr cs:oirq1
  180.         iret
  181.  
  182. ;═════════════════════════════════════════════════════════════════════════════
  183. vidmemm0:                               ; Vidmem mode 0 (character bitmap dat)
  184.         mov dx,3c4h
  185.     mov ax,00402h
  186.         out dx,ax
  187.         mov ax,00604h
  188.         out dx,ax
  189.         mov dx,3ceh
  190.     mov ax,00005h
  191.         out dx,ax
  192.         mov ax,00c06h
  193.         out dx,ax
  194.         mov ax,00204h
  195.         out dx,ax
  196.         ret
  197. ;═════════════════════════════════════════════════════════════════════════════
  198. vidmemm1:                               ; Vidmem mode 1 (screen character dat)
  199.         mov dx,3c4h
  200.         mov ax,00302h
  201.         out dx,ax
  202.         mov ax,00204h
  203.         out dx,ax
  204.         mov dx,3ceh
  205.         mov ax,01005h
  206.         out dx,ax
  207.         mov ax,00e06h
  208.         out dx,ax
  209.         mov ax,00004h
  210.         out dx,ax
  211.         ret
  212.  
  213. ;═════════════════════════════════════════════════════════════════════════════
  214. start:                                  ; Program starts here
  215.         cld
  216.         mov ax,cs
  217.         mov ds,ax
  218.  
  219.         xor bx,bx                       ; Chek for VGA
  220.         mov ax,01a00h
  221.         int 10h
  222.         cmp bl,7
  223.         jae short startf0
  224. exiterr0:
  225.         mov dx,offset errmsg0
  226. exiterr:
  227.         mov ah,9
  228.         int 21h
  229.         mov ax,4cffh
  230.         int 21h
  231. startf0:
  232.         cmp bl,0ch
  233.         ja short exiterr0
  234.  
  235.         mov ax,word ptr es:[2]          ; Chek for memory
  236.         sub ax,buf
  237.         cmp ax,NRF*4bh
  238.         mov dx,offset errmsg1
  239.         jb exiterr
  240.  
  241.         mov ax,3                        ; Text mode 3
  242.         int 10h
  243.  
  244.         call calcbuf                    ; Calculate raster bar buffers
  245.  
  246.         in al,21h                       ; Mask off ALL IRQs except 1
  247.         mov oirqm[0],al
  248.         mov al,0fdh
  249.         out 21h,al
  250.         in al,0a1h
  251.         mov oirqm[1],al
  252.         mov al,0ffh
  253.         out 0a1h,al
  254.  
  255.         mov ax,3509h                    ; Set new keyboard handler
  256.         int 21h
  257.         mov oirq1[0],bx
  258.         mov oirq1[2],es
  259.         mov dx,offset nirq1
  260.         mov ax,2509h
  261.         int 21h
  262.  
  263.         mov ax,cs                       ; Set character set for ren logo
  264.         mov es,ax
  265.         mov bp,offset charmap
  266.         mov ax,1100h
  267.         mov bx,1000h
  268.         mov cx,14
  269.         mov dx,182
  270.         int 10h
  271.  
  272. ;-----------------------------------------------------------------------------
  273.                                         ; Prepare for main part
  274.         mov ax,0b800h                   ; Clear screen
  275.         mov es,ax
  276.         xor di,di
  277.         mov cx,4000h
  278.         mov ax,1020h
  279.         rep stosw
  280.  
  281.         mov ah,1eh                      ; Put renaissance logo
  282.         mov si,offset renlogo
  283.         mov di,8232
  284.         mov dl,3
  285. startl0:
  286.         mov cx,33
  287. startl1:
  288.         lodsb
  289.         mov bp,offset rlltbl
  290. startl2:
  291.         mov bx,ds:[bp]
  292.         add bp,2
  293.         mov es:[di+bx],ax
  294.         cmp bx,5120-80
  295.         jne startl2
  296.         stosw
  297.         loop startl1
  298.         add di,254
  299.         dec dl
  300.         jnz startl0
  301.  
  302.         mov dx,3dah                     ; Set PEL resetting on line compare
  303.         in al,dx
  304.         mov dx,3c0h
  305.         mov al,30h
  306.         out dx,al
  307.         mov al,2ch
  308.         out dx,al
  309.  
  310.         mov dx,3d4h                     ; Set up for line compare split
  311.         mov ax,0e11h
  312.         out dx,ax
  313.         mov ax,0f09h
  314.         out dx,ax
  315.         mov ax,1f07h
  316.         out dx,ax
  317.         mov ax,5013h                    ; Set double screen width
  318.         out dx,ax
  319.         mov ax,800eh                    ; Hide cursor
  320.         out dx,ax
  321.  
  322.         mov ax,buf                      ; Set ptr to raster bar buffer
  323.  
  324. ;═════════════════════════════════════════════════════════════════════════════
  325. mainloop0:                              ; Set raster bar buffer ptr
  326.         add ax,4bh
  327.         cmp ax,buf+(NRF*4bh)
  328.         jb short mainloop
  329.         mov ax,buf
  330.  
  331. ;═════════════════════════════════════════════════════════════════════════════
  332. mainloop:                               ; Main loop
  333.         mov es,ax
  334.  
  335.         mov dx,3dah                     ; Wait for negative vertical retrace
  336.         in al,dx
  337.         test al,8
  338.         jnz $-3
  339.  
  340.         db 0b8h                         ; Do upper part flying around on X
  341. upxl    dw 0
  342.         add al,ah
  343.         cmp al,112
  344.         ja short mainloopf4
  345.         inc ah
  346.         jmp short mainloopf5
  347. mainloopf4:
  348.         dec ah
  349. mainloopf5:
  350.         mov upxl,ax
  351. ; xflipv  dw 9090h
  352.         xor ah,ah
  353.         xor dx,dx
  354.         mov bx,9
  355.         div bx
  356.         mov cx,ax
  357.         mov bl,dl
  358.         mov ah,xofftbl[bx]
  359.         mov al,33h
  360.         mov dx,3c0h
  361.         out dx,al
  362.         mov al,ah
  363.         out dx,al
  364.  
  365.         db 0b8h                         ; Do upper part flying around on Y
  366. upyl    dw 0
  367.         add ah,al
  368.         cmp ah,96
  369.         ja short mainloopf2
  370.         inc al
  371.         jmp short mainloopf3
  372. mainloopf2:
  373.         dec al
  374. mainloopf3:
  375.         mov upyl,ax
  376. ; yflipv  db 90h,90h,90h,90h,90h
  377.         mov bl,ah
  378.         and bl,0f0h
  379.         and ax,0f00h
  380.         mov al,8
  381.         mov dx,3d4h
  382.         out dx,ax
  383.         mov al,10
  384.         mul bl
  385.         add cx,ax
  386.         add cx,2000
  387.         mov al,0ch
  388.         mov ah,ch
  389.         out dx,ax
  390.         inc al
  391.         mov ah,cl
  392.         out dx,ax
  393.  
  394.         db 0b8h
  395. lcsl    dw 1                            ; Do line compare bobbing
  396.         add ah,al
  397.         jz short mainloopf0
  398.         cmp ah,48
  399.         jne short mainloopf1
  400. mainloopf0:
  401.         neg al
  402. mainloopf1:
  403.         mov lcsl,ax
  404.         mov al,18h
  405.         out dx,ax
  406.  
  407. ;       xor xflipv,6fa4h                ; Do screen flip xors
  408. ;       xor word ptr yflipv[0],7c10h
  409. ;       xor word ptr yflipv[2],6640h
  410. ;       xor byte ptr yflipv[4],4ch
  411.  
  412.         call textrout                   ; Do text on lower part of screen
  413.  
  414.         call c0cycrout                  ; Phade bars in and out
  415.         call c1cycrout
  416.  
  417.         mov bx,400                      ; Prepare for loop
  418.         xor si,si
  419.         mov al,byte ptr lcsl[1]
  420.         mov ah,1
  421.         mov di,400
  422.         sub di,ax
  423.         mov cx,ccycvals
  424.  
  425.         mov dx,3dah                     ; Wait for vertical retrace
  426.         in al,dx
  427.         test al,8
  428.         jz $-3
  429.  
  430. ;─────────────────────────────────────────────────────────────────────────────
  431. mainloop2:                              ; Secondary main loop
  432.         mov dx,3c8h                     ; Prepare color write
  433.         mov al,1
  434.         out dx,al
  435.         inc dx
  436.  
  437.         cmp bx,di                       ; Special routine maybe
  438.         je short mainloop2s
  439.  
  440.         lods byte ptr es:[si]
  441.         xchg cl,ch
  442.         shr al,cl
  443.         xchg cl,ch
  444.         out dx,al
  445.         lods byte ptr es:[si]
  446.         out dx,al
  447.  
  448.         mov dx,3dah                     ; Wait for display interval
  449.         in al,dx
  450.         test al,1
  451.         jnz short $-3
  452.         in al,dx                        ; Wait for horizontal retrace
  453.         test al,1
  454.         jz short $-3
  455.  
  456.         mov dx,3c9h                     ; Set last byte of color
  457.         lods byte ptr es:[si]
  458.         shr al,cl
  459.         out dx,al
  460.  
  461. mainloop2c:
  462.         dec bx
  463.         jnz mainloop2
  464.  
  465.         cmp doneflag,1                  ; Done?
  466.         je short done
  467.  
  468.         mov ax,es                       ; Increment buffer ptr
  469.         jmp mainloop0
  470.  
  471. ;-----------------------------------------------------------------------------
  472. mainloop2s:                             ; Special split loc routine
  473.         mov al,3fh
  474.         out dx,al
  475.         out dx,al
  476.  
  477.         mov dx,3dah                     ; Wait for display interval
  478.         in al,dx
  479.         test al,1
  480.         jnz short $-3
  481.         in al,dx                        ; Wait for horizontal retrace
  482.         test al,1
  483.         jz short $-3
  484.  
  485.         mov dx,3c9h                     ; Set last byte of special color
  486.         mov al,3fh
  487.         out dx,al
  488.  
  489.         add cx,101h
  490.         jmp mainloop2c
  491.  
  492. ;═════════════════════════════════════════════════════════════════════════════
  493. done:                                   ; Program done
  494.         mov al,oirqm[0]                 ; Reset IRQ masks
  495.         out 21h,al
  496.         mov al,oirqm[1]
  497.         out 0a1h,al
  498.         lds dx,dword ptr oirq1          ; Reset keyboard vektor
  499.         mov ax,2509h
  500.         int 21h
  501.         mov ax,3                        ; Text mode 3
  502.         int 10h
  503.         mov ax,4c00h                    ; Quit to DOS
  504.         int 21h
  505.  
  506. ;─────────────────────────────────────────────────────────────────────────────
  507. c0cycr0:                                ; Cycle blue bar delay
  508.         dec c0cycdelay
  509.         jz short c0cycr0f0
  510.         ret
  511. c0cycr0f0:
  512.         mov c0cycrout,offset c0cycr1
  513. __ret:
  514.         ret
  515. ;─────────────────────────────────────────────────────────────────────────────
  516. c0cycr1:                                ; Cycle blue bar change
  517.         dec c0cycwait
  518.         jnz __ret
  519.         mov c0cycwait,CCYCWAIT
  520.         mov ax,ccycvals
  521.         mov bx,ccycdeltas
  522.         add al,bl
  523.         jz short c0cycr1f0
  524.         cmp al,6
  525.         jnz short c0cycr1f1
  526. c0cycr1f0:
  527.         neg bl
  528.         mov c0cycdelay,720
  529.         mov c0cycrout,offset c0cycr0
  530. c0cycr1f1:
  531.         mov ccycvals,ax
  532.         mov ccycdeltas,bx
  533.         ret
  534.  
  535. ;─────────────────────────────────────────────────────────────────────────────
  536. c1cycr0:                                ; Cycle red bar delay
  537.         dec c1cycdelay
  538.         jz short c1cycr0f0
  539.         ret
  540. c1cycr0f0:
  541.         mov c1cycrout,offset c1cycr1
  542.         ret
  543. ;─────────────────────────────────────────────────────────────────────────────
  544. c1cycr1:                                ; Cycle blue bar change
  545.         dec c1cycwait
  546.         jnz __ret
  547.         mov c1cycwait,CCYCWAIT
  548.         mov ax,ccycvals
  549.         mov bx,ccycdeltas
  550.         add ah,bh
  551.         jz short c1cycr1f0
  552.         cmp ah,6
  553.         jnz short c1cycr1f1
  554. c1cycr1f0:
  555.         neg bh
  556.         mov c1cycdelay,720
  557.         mov c1cycrout,offset c1cycr0
  558. c1cycr1f1:
  559.         mov ccycvals,ax
  560.         mov ccycdeltas,bx
  561.         ret
  562.  
  563. ;═════════════════════════════════════════════════════════════════════════════
  564. txtdelay:                               ; Text delay routine
  565.         dec textwait
  566.         je short txtnext
  567.         ret
  568.  
  569. ;-----------------------------------------------------------------------------
  570. txtsetdelay:                            ; Delay command in text
  571.         mov al,ah
  572.         xor ah,ah
  573.         shl ax,1
  574.         shl ax,1
  575.         mov textwait,ax
  576.         mov textrout,offset txtdelay
  577.         mov textptr,si
  578.         ret
  579. ;-----------------------------------------------------------------------------
  580. txtreset:                               ; Reset text pointer
  581.         mov textptr,offset text
  582. ;-----------------------------------------------------------------------------
  583. txtnext:                                ; Get next text command
  584.         mov si,textptr
  585.         lodsw
  586.         cmp al,-2
  587.         je short txtsetdelay
  588.         ja short txtreset
  589.         mov bl,ah
  590.         xor bh,bh
  591.         shl bx,1
  592.         xor ah,ah
  593.         mov cx,320
  594.         mul cx
  595.         add ax,bx
  596.         mov textloc,ax
  597.         lodsb
  598.         mov textattr,al
  599.         mov textptr,si
  600.         mov textrout,offset txtputr1
  601.         ret
  602.  
  603. ;-----------------------------------------------------------------------------
  604. txtputr0:                               ; Replace old char with 7fh and attr
  605.         push es
  606.         mov ax,0b800h
  607.         mov es,ax
  608.         mov bx,textloc
  609.         mov al,es:[bx]
  610.         xor ah,ah
  611.         mov cl,5
  612.         shl ax,cl
  613.         mov si,ax
  614.         mov di,0fe0h
  615.         call vidmemm0
  616.         mov cx,10h
  617.         db 26h
  618.         rep movsw
  619.         call vidmemm1
  620.         mov al,7fh
  621.         mov ah,textattr
  622.         mov es:[bx],ax
  623.         pop es
  624.         ret
  625. ;-----------------------------------------------------------------------------
  626. txtputr1:                               ; Start character bitblt routine
  627.         mov si,textptr
  628.         lodsb
  629.         mov textptr,si
  630.         or al,al
  631.         jnz short txtputr1f0
  632.         mov textrout,offset txtnext
  633.         ret
  634. txtputr1f0:
  635.         mov textchar,al
  636.         xor ah,ah
  637.         mov cl,5
  638.         shl ax,cl
  639.         mov textcharloc,ax
  640.         mov textrout,offset txtputr2
  641.         mov textbltloc,8
  642.         jmp txtputr0
  643. ;-----------------------------------------------------------------------------
  644. txtputr2:
  645.         push es
  646.         mov ax,0b800h
  647.         mov es,ax
  648.         call vidmemm0
  649.         mov si,textcharloc
  650.         mov di,0fe0h
  651.         mov bx,textbltloc
  652.         mov bp,0fh
  653. txtputr2l0:
  654.         mov ah,textbltmap[bx]
  655.         mov al,es:[si+bp]
  656.         mov dl,es:[di+bp]
  657.         and al,ah
  658.         not ah
  659.         and dl,ah
  660.         not ah
  661.         or al,dl
  662.         mov es:[di+bp],al
  663.         inc bx
  664.         sub bp,1
  665.         jnc txtputr2l0
  666.         call vidmemm1
  667.         sub textbltloc,1
  668.         jnc short txtputr2d
  669.         mov textrout,offset txtputr1
  670.         mov bx,textloc
  671.         mov al,textchar
  672.         mov es:[bx],al
  673.         add bx,2
  674.         mov textloc,bx
  675. txtputr2d:
  676.         pop es
  677.         ret
  678.  
  679. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  680. ; Calculate raster bar buffers
  681. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  682. calcbuf:
  683.         sub sp,16
  684.  
  685.         mov bx,buf                      ; Clear each frame
  686.         xor ax,ax
  687.         mov dx,NRF
  688. calcbufl0:
  689.         mov es,bx
  690.         xor di,di
  691.         mov cx,600
  692.         rep stosw
  693.         add bx,4bh
  694.         dec dx
  695.         jnz calcbufl0
  696.  
  697.         mov bp,sp                       ; Draw red moving bars
  698.         mov si,offset bardata
  699. calcbufl1:
  700.         mov ax,ss
  701.         mov es,ax
  702.         lodsw
  703.         or ax,ax
  704.         jz calcbufl1d
  705.         mov di,bp
  706.         mov cx,8
  707.         rep movsw
  708.         mov cx,ax
  709.         push si
  710.         call calcbufr0
  711.         pop si
  712.         jmp calcbufl1
  713. calcbufl1d:
  714.  
  715.         mov word ptr [bp],8             ; Do blue perspective bars
  716.         mov word ptr [bp+2],buf
  717. calcbufl2:
  718.         mov word ptr [bp+4],7
  719. calcbufl3:
  720.         mov ax,9
  721.         mul word ptr [bp+4]
  722.         add ax,[bp]
  723.         mov si,ax
  724.         shl si,1
  725.         shl si,1
  726.         add si,90
  727.         mov cl,3
  728.         shr ax,cl
  729.         shl ax,1
  730.         mov bx,ax
  731.  
  732.         mov ax,-90*193
  733.         cwd
  734.         idiv si
  735.         add ax,200
  736.         mov di,ax
  737.         shl ax,1
  738.         add di,ax
  739.         call calcbufr2
  740.  
  741.         mov ax,90*192
  742.         cwd
  743.         idiv si
  744.         add ax,200
  745.         mov di,ax
  746.         shl ax,1
  747.         add di,ax
  748.         call calcbufr2
  749.  
  750.         sub word ptr [bp+4],1
  751.         jnc calcbufl3
  752.         add word ptr [bp+2],4bh
  753.         sub word ptr [bp],1
  754.         jnc calcbufl2
  755.  
  756.         add sp,16
  757. _ret:
  758.         ret
  759. ;─────────────────────────────────────────────────────────────────────────────
  760. calcbufr0:                              ; Calculate a bar across all frames
  761.         xor di,di                       ; Set starting pointers
  762.         xor si,si
  763.         mov dx,buf
  764. calcbufr0l0:                            ; Calculate back CX frames
  765.         call calcbufr1
  766.         loop calcbufr0l0
  767.         mov bx,NRF                      ; Draw bars
  768. calcbufr0l1:
  769.         push di
  770.         mov es,dx
  771.         xor al,al
  772.         mov cx,8
  773. calcbufr0l2:
  774.         stosb
  775.         add di,2
  776.         call [bp+0]
  777.         stosb
  778.         add di,2
  779.         call [bp+2]
  780.         stosb
  781.         add di,2
  782.         call [bp+4]
  783.         stosb
  784.         add di,2
  785.         call [bp+6]
  786.         loop calcbufr0l2
  787.         mov cx,8
  788. calcbufr0l3:
  789.         call [bp+14]
  790.         stosb
  791.         add di,2
  792.         call [bp+12]
  793.         stosb
  794.         add di,2
  795.         call [bp+10]
  796.         stosb
  797.         add di,2
  798.         call [bp+8]
  799.         stosb
  800.         add di,2
  801.         loop calcbufr0l3
  802.         pop di
  803.         call calcbufr1
  804.         add dx,4bh
  805.         dec bx
  806.         jnz calcbufr0l1
  807.         ret
  808. ;-----------------------------------------------------------------------------
  809. calcbufr1:                              ; Move bar one unit
  810.         add di,si
  811.         cmp di,170*3
  812.         ja short calcbufr1f0
  813.         add si,3
  814.         jmp calcbufr1f1
  815. calcbufr1f0:
  816.         sub si,3
  817. calcbufr1f1:
  818.         ret
  819. ;-----------------------------------------------------------------------------
  820. calcbufcar1:                            ; Color Add Routine 1
  821.         inc al
  822.         ret
  823. ;-----------------------------------------------------------------------------
  824. calcbufcar2:                            ; Color Add Routine 2
  825.         add al,2
  826.         ret
  827. ;-----------------------------------------------------------------------------
  828. calcbufcsr1:                            ; Color Sub Routine 1
  829.         dec al
  830.         ret
  831. ;-----------------------------------------------------------------------------
  832. calcbufcsr2:                            ; Color Sub Routine 2
  833.         sub al,2
  834.         ret
  835. ;─────────────────────────────────────────────────────────────────────────────
  836. calcbufr2:                              ; Draw a blue bar
  837.         mov dx,[bp+2]
  838.         mov cx,8
  839.         xor ax,ax
  840. calcbufr2l0:
  841.         mov ds,dx
  842.         add dx,2a3h
  843.         call cs:pbarf[bx]
  844.         loop calcbufr2l0
  845.         mov ax,cs
  846.         mov ds,ax
  847.         ret
  848. ;-----------------------------------------------------------------------------
  849. pbarr0:
  850.         mov byte ptr [di-19],07h
  851.         mov byte ptr [di+23],07h
  852. ;-----------------------------------------------------------------------------
  853. pbarr1:
  854.         mov byte ptr [di-16],0fh
  855.         mov byte ptr [di+20],0fh
  856. ;-----------------------------------------------------------------------------
  857. pbarr2:
  858.         mov byte ptr [di-13],17h
  859.         mov byte ptr [di+17],17h
  860. ;-----------------------------------------------------------------------------
  861. pbarr3:
  862.         mov byte ptr [di-10],1fh
  863.         mov byte ptr [di+14],1fh
  864. ;-----------------------------------------------------------------------------
  865. pbarr4:
  866.         mov byte ptr [di-7],27h
  867.         mov byte ptr [di+11],27h
  868. ;-----------------------------------------------------------------------------
  869. pbarr5:
  870.         mov byte ptr [di-4],2fh
  871.         mov byte ptr [di+8],2fh
  872. ;-----------------------------------------------------------------------------
  873. pbarr6:
  874.         mov byte ptr [di-1],37h
  875.         mov byte ptr [di+5],37h
  876. ;-----------------------------------------------------------------------------
  877. pbarr7:
  878.         mov byte ptr [di+2],3fh
  879.         ret
  880.  
  881.  
  882. code    ends
  883. buf     segment para
  884. buf     ends
  885.         end start
  886.  
  887.